load("@fbcode//clifoundation/cli_target/buck_defs:cli.bzl", "cli")
load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library")
load("//fastcli:defs.bzl", "auto_tab_complete")

oncall("fboss_agent_push")

thrift_library(
    name = "cli",
    languages = [
        "cpp2",
    ],
    thrift_cpp2_options = "json",
    thrift_srcs = {"cli.thrift": []},
)

# NOTE: all of the actual command tree is managed inside CmdList.cpp
# CmdList.h defines the data structure
cpp_library(
    name = "cmd-list-header",
    headers = [
        "CmdList.h",
    ],
    exported_deps = [
        ":cmd-common-utils",
        ":cmd-global-options",
    ],
)

cpp_library(
    name = "cmd-global-options",
    srcs = [
        "CmdGlobalOptions.cpp",
        "facebook/CmdGlobalOptions.cpp",
    ],
    headers = [
        "CmdGlobalOptions.h",
    ],
    exported_deps = [
        ":cli-cpp2-types",
        ":ops-utils",
        ":options",
        "//folly:singleton",
        "//folly:string",
    ],
    exported_external_deps = [
        "CLI11",
    ],
)

cpp_library(
    name = "cmd-local-options",
    srcs = [
        "CmdLocalOptions.cpp",
    ],
    headers = [
        "CmdLocalOptions.h",
    ],
    exported_deps = [
        ":cmd-common-utils",
        "//folly:singleton",
    ],
)

cpp_library(
    name = "cmd-subcommands",
    srcs = [
        "CmdArgsLists.cpp",
        "CmdSubcommands.cpp",
    ],
    headers = [
        "CmdArgsLists.h",
        "CmdSubcommands.h",
    ],
    exported_deps = [
        ":cli-parser-utils",
        ":cmd-common-utils",
        ":cmd-list-header",
        ":cmd-local-options",
        "//folly:singleton",
        "//folly:string",
    ],
    exported_external_deps = [
        "CLI11",
    ],
)

cpp_library(
    name = "cmd-handler",
    headers = [
        "CmdHandler.cpp",
        "CmdHandler.h",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":cmd-common-utils",
        ":cmd-global-options",
        ":cmd-subcommands",
        "//folly/logging:logging",
        "//thrift/lib/cpp/util:enum_utils",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
)

cpp_library(
    name = "options",
    headers = [
        "options/OutputFormat.h",
        "options/SSLPolicy.h",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:string",
    ],
    exported_external_deps = [
        "CLI11",
    ],
)

cpp_library(
    name = "ops-utils",
    headers = [
        "utils/AggregateOp.h",
        "utils/FilterOp.h",
    ],
    exported_deps = [
        "//folly:string",
    ],
)

cpp_library(
    name = "cli-parser-utils",
    srcs = [
        "utils/CLIParserUtils.cpp",
    ],
    headers = [
        "utils/CLIParserUtils.h",
    ],
    exported_external_deps = [
        "CLI11",
    ],
)

cpp_library(
    name = "cmd-common-utils",
    srcs = [
        "utils/CmdUtilsCommon.cpp",
    ],
    headers = [
        "commands/clear/CmdClearUtils.h",
        "utils/AggregateUtils.h",
        "utils/CmdClientUtilsCommon.h",
        "utils/CmdUtilsCommon.h",
        "utils/FilterUtils.h",
        "utils/HostInfo.h",
    ],
    exported_deps = [
        ":cmd-global-options",
        "//common/time:time_core",
        "//fboss/agent/if:ctrl-cpp2-services",
        "//folly:network_address",
        "//folly:stop_watch",
        "//folly:string",
        "//folly/gen:base",
        "//folly/logging:logging",
        "//thrift/lib/cpp2/async:rocket_client_channel",
        "//thrift/lib/cpp2/visitation:visitation",
        "//thrift/lib/thrift:metadata-cpp2-types",
    ],
    exported_external_deps = [
        "CLI11",
    ],
)

cpp_library(
    name = "table-utils",
    srcs = [
        "utils/Table.cpp",
    ],
    headers = [
        "utils/Table.h",
    ],
    exported_deps = [
        ":cmd-global-options",
    ],
    exported_external_deps = [
        "tabulatecpp",
    ],
)

cpp_library(
    name = "cmd-show-utils",
    headers = [
        "commands/show/facebook/CmdShowUtils.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyUtils.h",
    ],
    exported_deps = [
        ":cmd-common-utils",
        ":cmd-handler",
        "//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types",
        "//configerator/structs/neteng/bgp_policy/thrift:routing_policy-cpp2-types",
        "//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types",
        "//folly/json:dynamic",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-types",
        "//openr/if:if-cpp2-types",
        "//openr/if:types-cpp2-types",
    ],
)

cpp_library(
    name = "commands-show-bgp",
    headers = [
        "commands/show/facebook/bgp/CmdShowBgpInitializationEvents.h",
        "commands/show/facebook/bgp/CmdShowBgpOriginatedRoutes.h",
        "commands/show/facebook/bgp/changelist/CmdShowBgpChangelist.h",
        "commands/show/facebook/bgp/neighbors/CmdShowBgpNeighbors.h",
        "commands/show/facebook/bgp/neighbors/advertised/BgpNeighborsAdvertisedDryRun.h",
        "commands/show/facebook/bgp/neighbors/advertised/BgpNeighborsAdvertisedPostPolicy.h",
        "commands/show/facebook/bgp/neighbors/advertised/BgpNeighborsAdvertisedPrePolicy.h",
        "commands/show/facebook/bgp/neighbors/advertised/BgpNeighborsAdvertisedRejected.h",
        "commands/show/facebook/bgp/neighbors/received/BgpNeighborsReceivedDryRun.h",
        "commands/show/facebook/bgp/neighbors/received/BgpNeighborsReceivedPostPolicy.h",
        "commands/show/facebook/bgp/neighbors/received/BgpNeighborsReceivedPrePolicy.h",
        "commands/show/facebook/bgp/neighbors/received/BgpNeighborsReceivedRejected.h",
        "commands/show/facebook/bgp/neighbors/session_id/CmdBgpNeighborsSessionId.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicy.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyCps.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyCrf.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyCte.h",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyGoldenPrefixes.h",
        "commands/show/facebook/bgp/ribpolicy/criteria/CmdShowBgpRibPolicyCriteria.h",
        "commands/show/facebook/bgp/shadowrib/CmdShowBgpShadowRib.h",
        "commands/show/facebook/bgp/stats/CmdShowBgpStatsAttrs.h",
        "commands/show/facebook/bgp/stats/CmdShowBgpStatsEntries.h",
        "commands/show/facebook/bgp/stats/CmdShowBgpStatsPolicy.h",
        "commands/show/facebook/bgp/stream/CmdShowBgpStreamSubscriber.h",
        "commands/show/facebook/bgp/stream/CmdShowBgpStreamSummary.h",
        "commands/show/facebook/bgp/stream/subscriber/CmdShowBgpStreamSubscriberPostPolicy.h",
        "commands/show/facebook/bgp/stream/subscriber/CmdShowBgpStreamSubscriberPrePolicy.h",
        "commands/show/facebook/bgp/summary/CmdShowBgpSummary.h",
        "commands/show/facebook/bgp/summary/egress/CmdShowBgpSummaryEgress.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTable.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTableCommunity.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTableDetail.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTableFbnet.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTableMoreSpecifics.h",
        "commands/show/facebook/bgp/table/CmdShowBgpTablePrefix.h",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":cmd-common-utils",
        ":cmd-handler",
        ":cmd-show-utils",  # @manual
        ":table-utils",
        "//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types",
        "//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/bgp/ribpolicy/criteria:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-types",
        "//folly:network_address",
        "//folly:string",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-services",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-types",
        "//neteng/routing/policy/if:policy_thrift-cpp2-types",
        "//nettools/bgplib:bgp_structs",
        "//thrift/lib/cpp/util:enum_utils",
    ],
)

cpp_library(
    name = "fboss2-lib",
    srcs = [
        "CmdHandlerImpl.cpp",
        "CmdList.cpp",
        "commands/create/facebook/config/CmdCreateConfigUtils.cpp",
        "commands/debug/facebook/CmdDebugUtils.cpp",
        "commands/delete/facebook/config/CmdDeleteConfigUtils.cpp",
        "commands/show/acl/CmdShowAcl.cpp",
        "commands/show/agent/CmdShowAgentFirmware.cpp",
        "commands/show/agent/CmdShowAgentSsl.cpp",
        "commands/show/aggregateport/CmdShowAggregatePort.cpp",
        "commands/show/arp/CmdShowArp.cpp",
        "commands/show/cpuport/CmdShowCpuPort.cpp",
        "commands/show/dsfnodes/CmdShowDsfNodes.cpp",
        "commands/show/example/CmdShowExample.cpp",
        "commands/show/fabric/CmdShowFabric.cpp",
        "commands/show/fabric/monitoring/CmdShowFabricMonitoringCounters.cpp",
        "commands/show/fabric/monitoring/CmdShowFabricMonitoringDetails.cpp",
        "commands/show/fabric/reachability/CmdShowFabricReachability.cpp",
        "commands/show/fabric/reachability/uncached/CmdShowFabricReachabilityUncached.cpp",
        "commands/show/facebook/CmdShowUtils.cpp",
        "commands/show/facebook/CmdShowVersionAgent.cpp",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyUtils.cpp",
        "commands/show/facebook/config/CmdShowConfigUtils.cpp",
        "commands/show/facebook/environment/env_keys.cpp",
        "commands/show/facebook/environment/fan/CmdShowEnvironmentFan.cpp",
        "commands/show/facebook/environment/power/CmdShowEnvironmentPower.cpp",
        "commands/show/facebook/environment/sensor/CmdShowEnvironmentSensor.cpp",
        "commands/show/facebook/state/CmdShowStateDrain.cpp",
        "commands/show/facebook/techsupport/CmdShowTechSupport.cpp",
        "commands/show/fsdb/CmdShowFsdbUtils.cpp",
        "commands/show/hwagent/CmdShowHwAgentStatus.cpp",
        "commands/show/lldp/CmdShowLldp.cpp",
        "commands/show/mac/CmdShowMacDetails.cpp",
        "commands/show/ndp/CmdShowNdp.cpp",
        "commands/show/port/CmdShowPort.cpp",
        "commands/show/rif/CmdShowRif.cpp",
        "commands/show/route/utils.cpp",
        "commands/show/systemport/CmdShowSystemPort.cpp",
        "facebook/CmdHandlerImpl.cpp",
        "facebook/CmdList.cpp",
        "facebook/CmdStreamHandler.cpp",
        "utils/CmdClientUtils.cpp",
        "utils/CmdUtils.cpp",
        "utils/NetwhoamiUtils.cpp",
        "utils/PrbsUtils.cpp",
        "utils/TeFlowUtils.cpp",
        "utils/clients/BmcClient.cpp",
        "utils/facebook/CmdClientUtils.cpp",
        "utils/facebook/CmdUtils.cpp",
    ],
    headers = [
        "commands/bounce/interface/CmdBounceInterface.h",
        "commands/clear/CmdClearArp.h",
        "commands/clear/CmdClearInterfaceCounters.h",
        "commands/clear/CmdClearNdp.h",
        "commands/clear/facebook/CmdClearMirror.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicy.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicyCps.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicyCrf.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicyCte.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicyGoldenPrefixes.h",
        "commands/clear/facebook/bgp/ribpolicy/CmdClearBgpRibPolicyRouteFilters.h",
        "commands/clear/facebook/bgp/ribpolicy/Constants.h",
        "commands/clear/facebook/teflow/CmdClearTeFlow.h",
        "commands/clear/interface/CmdClearInterface.h",
        "commands/clear/interface/counters/phy/CmdClearInterfaceCountersPhy.h",
        "commands/clear/interface/prbs/CmdClearInterfacePrbs.h",
        "commands/clear/interface/prbs/stats/CmdClearInterfacePrbsStats.h",
        "commands/create/facebook/CmdCreateConfig.h",
        "commands/create/facebook/CmdCreateMirror.h",
        "commands/create/facebook/config/CmdCreateConfigPatcherAgent.h",
        "commands/create/facebook/config/CmdCreateConfigUtils.h",
        "commands/create/facebook/teflow/CmdCreateTeFlow.h",
        "commands/debug/facebook/CmdDebugUtils.h",
        "commands/debug/facebook/bgp/add_network/CmdDebugBgpAddNetwork.h",
        "commands/debug/facebook/bgp/add_network/CmdDebugBgpAddNetworkAsPath.h",
        "commands/debug/facebook/bgp/add_network/CmdDebugBgpAddNetworkCommunity.h",
        "commands/debug/facebook/bgp/add_network/CmdDebugBgpAddNetworkLocalPref.h",
        "commands/debug/facebook/bgp/del_network/CmdDebugBgpDelNetwork.h",
        "commands/debug/facebook/bgp/neighbors/CmdDebugBgpNeighbors.h",
        "commands/debug/facebook/bgp/neighbors/CmdDebugBgpNeighborsRestart.h",
        "commands/debug/facebook/bgp/neighbors/CmdDebugBgpNeighborsShutdown.h",
        "commands/debug/facebook/bgp/neighbors/CmdDebugBgpNeighborsStart.h",
        "commands/delete/facebook/config/CmdDeleteConfigPatcherAgent.h",
        "commands/delete/facebook/config/CmdDeleteConfigUtils.h",
        "commands/facebook/rage/CmdRage.h",
        "commands/facebook/stream/CmdStreamDummy.h",
        "commands/facebook/stream/bgp/CmdStreamBgpAll.h",
        "commands/get/pcap/CmdGetPcap.h",
        "commands/help/CmdHelp.h",
        "commands/reload/facebook/CmdReloadConfigAgent.h",
        "commands/set/debug/facebook/CmdSetDebugBgp.h",
        "commands/set/fanhold/CmdSetFanHold.h",
        "commands/set/interface/CmdSetInterface.h",
        "commands/set/interface/prbs/CmdSetInterfacePrbs.h",
        "commands/set/interface/prbs/state/CmdSetInterfacePrbsState.h",
        "commands/set/port/CmdSetPort.h",
        "commands/set/port/state/CmdSetPortState.h",
        "commands/show/acl/CmdShowAcl.h",
        "commands/show/agent/CmdShowAgentFirmware.h",
        "commands/show/agent/CmdShowAgentSsl.h",
        "commands/show/aggregateport/CmdShowAggregatePort.h",
        "commands/show/arp/CmdShowArp.h",
        "commands/show/cpuport/CmdShowCpuPort.h",
        "commands/show/dsf/CmdShowDsf.h",
        "commands/show/dsf/subscription/CmdShowDsfSubscription.h",
        "commands/show/dsfnodes/CmdShowDsfNodes.h",
        "commands/show/example/CmdShowExample.h",
        "commands/show/fabric/CmdShowFabric.h",
        "commands/show/fabric/inputbalance/CmdShowFabricInputBalance.h",
        "commands/show/fabric/monitoring/CmdShowFabricMonitoringCounters.h",
        "commands/show/fabric/monitoring/CmdShowFabricMonitoringDetails.h",
        "commands/show/fabric/reachability/CmdShowFabricReachability.h",
        "commands/show/fabric/reachability/uncached/CmdShowFabricReachabilityUncached.h",
        "commands/show/fabric/topology/CmdShowFabricTopology.h",
        "commands/show/facebook/CmdShowAmIFboss.h",
        "commands/show/facebook/CmdShowMka.h",
        "commands/show/facebook/CmdShowVersionAgent.h",
        "commands/show/facebook/CmdShowVersionBgp.h",
        "commands/show/facebook/CmdShowVersionCoop.h",
        "commands/show/facebook/CmdShowVersionDataCorralService.h",
        "commands/show/facebook/CmdShowVersionFsdb.h",
        "commands/show/facebook/CmdShowVersionLed.h",
        "commands/show/facebook/CmdShowVersionMka.h",
        "commands/show/facebook/CmdShowVersionQsfp.h",
        "commands/show/facebook/CmdShowVersionRackmon.h",
        "commands/show/facebook/CmdShowVersionSDK.h",
        "commands/show/facebook/CmdShowVersionSensorService.h",
        "commands/show/facebook/bgp/techsupport/CmdShowBgpTechsupport.h",
        "commands/show/facebook/bmc/CmdShowBmcInfo.h",
        "commands/show/facebook/config/CmdShowConfigHistoryAgent.h",
        "commands/show/facebook/config/CmdShowConfigHistoryBgp.h",
        "commands/show/facebook/config/CmdShowConfigPatchersAgent.h",
        "commands/show/facebook/config/CmdShowConfigPatchersBgp.h",
        "commands/show/facebook/config/CmdShowConfigRunningAgent.h",
        "commands/show/facebook/config/CmdShowConfigRunningBgp.h",
        "commands/show/facebook/config/CmdShowConfigUtils.h",
        "commands/show/facebook/config/CmdShowConfigVersionAgent.h",
        "commands/show/facebook/config/CmdShowConfigVersionBgp.h",
        "commands/show/facebook/debugdump/CmdShowDebugDumpVendor.h",
        "commands/show/facebook/environment/CmdShowEnvAll.h",
        "commands/show/facebook/environment/env_keys.h",
        "commands/show/facebook/environment/fan/CmdShowEnvironmentFan.h",
        "commands/show/facebook/environment/fan/CmdShowEnvironmentFanHold.h",
        "commands/show/facebook/environment/power/CmdShowEnvironmentPower.h",
        "commands/show/facebook/environment/sensor/CmdShowEnvironmentSensor.h",
        "commands/show/facebook/environment/temperature/CmdShowEnvironmentTemp.h",
        "commands/show/facebook/openr/CmdShowVersionOpenr.h",
        "commands/show/facebook/openr/advertised_routes/CmdShowOpenrAdvertisedRoutesAll.h",
        "commands/show/facebook/openr/advertised_routes/CmdShowOpenrAdvertisedRoutesPostAreaPolicy.h",
        "commands/show/facebook/openr/advertised_routes/CmdShowOpenrAdvertisedRoutesPostAreaPolicyPrefix.h",
        "commands/show/facebook/openr/advertised_routes/CmdShowOpenrAdvertisedRoutesPostOriginationPolicy.h",
        "commands/show/facebook/openr/kvtore/CmdShowOpenrKvstoreKeys.h",
        "commands/show/facebook/openr/lm/CmdShowOpenrLmAdj.h",
        "commands/show/facebook/openr/neighbors/CmdShowOpenrNeighbors.h",
        "commands/show/facebook/openr/received_routes/CmdShowOpenrReceivedRoutes.h",
        "commands/show/facebook/openr/received_routes/CmdShowOpenrReceivedRoutesArea.h",
        "commands/show/facebook/openr/received_routes/CmdShowOpenrReceivedRoutesNode.h",
        "commands/show/facebook/openr/spark/CmdShowOpenrSparkNeighbors.h",
        "commands/show/facebook/openr/unicast_routes/CmdShowOpenrUnicastRoutes.h",
        "commands/show/facebook/state/CmdShowStateDrain.h",
        "commands/show/facebook/techsupport/CmdShowTechSupport.h",
        "commands/show/facebook/vip/fib/CmdShowVipsFib.h",
        "commands/show/facebook/vip/injectors/CmdShowVipsInjectors.h",
        "commands/show/facebook/vip/overview/CmdShowVipsOverview.h",
        "commands/show/facebook/vip/prefixes/CmdShowVipsPrefixes.h",
        "commands/show/flowlet/CmdShowFlowlet.h",
        "commands/show/fsdb/CmdShowFsdbDataCommon.h",
        "commands/show/fsdb/CmdShowFsdbOperState.h",
        "commands/show/fsdb/CmdShowFsdbOperStats.h",
        "commands/show/fsdb/CmdShowFsdbPublishers.h",
        "commands/show/fsdb/CmdShowFsdbSubscribers.h",
        "commands/show/fsdb/CmdShowFsdbUtils.h",
        "commands/show/hardware/CmdShowHardware.h",
        "commands/show/host/CmdShowHost.h",
        "commands/show/hwagent/CmdShowHwAgentStatus.h",
        "commands/show/hwobject/CmdShowHwObject.h",
        "commands/show/interface/CmdShowInterface.h",
        "commands/show/interface/capabilities/CmdShowInterfaceCapabilities.h",
        "commands/show/interface/counters/CmdShowInterfaceCounters.h",
        "commands/show/interface/counters/fec/CmdShowInterfaceCountersFec.h",
        "commands/show/interface/counters/fec/ber/CmdShowInterfaceCountersFecBer.h",
        "commands/show/interface/counters/fec/histogram/CmdShowInterfaceCountersFecHistogram.h",
        "commands/show/interface/counters/fec/tail/CmdShowInterfaceCountersFecTail.h",
        "commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h",
        "commands/show/interface/counters/mka/CmdShowInterfaceCountersMKA.h",
        "commands/show/interface/errors/CmdShowInterfaceErrors.h",
        "commands/show/interface/flaps/CmdShowInterfaceFlaps.h",
        "commands/show/interface/phy/CmdShowInterfacePhy.h",
        "commands/show/interface/phymap/CmdShowInterfacePhymap.h",
        "commands/show/interface/prbs/CmdShowInterfacePrbs.h",
        "commands/show/interface/prbs/capabilities/CmdShowInterfacePrbsCapabilities.h",
        "commands/show/interface/prbs/state/CmdShowInterfacePrbsState.h",
        "commands/show/interface/prbs/stats/CmdShowInterfacePrbsStats.h",
        "commands/show/interface/status/CmdShowInterfaceStatus.h",
        "commands/show/interface/traffic/CmdShowInterfaceTraffic.h",
        "commands/show/l2/CmdShowL2.h",
        "commands/show/lldp/CmdShowLldp.h",
        "commands/show/mac/CmdShowMacAddrToBlock.h",
        "commands/show/mac/CmdShowMacDetails.h",
        "commands/show/mirror/CmdShowMirror.h",
        "commands/show/mpls/CmdShowMplsRoute.h",
        "commands/show/ndp/CmdShowNdp.h",
        "commands/show/port/CmdShowPort.h",
        "commands/show/port/CmdShowPortQueue.h",
        "commands/show/product/CmdShowProduct.h",
        "commands/show/product/CmdShowProductDetails.h",
        "commands/show/rif/CmdShowRif.h",
        "commands/show/route/CmdShowRoute.h",
        "commands/show/route/CmdShowRouteDetails.h",
        "commands/show/route/CmdShowRouteSummary.h",
        "commands/show/route/utils.h",
        "commands/show/sdk/dump/CmdShowSdkDump.h",
        "commands/show/systemport/CmdShowSystemPort.h",
        "commands/show/teflow/CmdShowTeFlow.h",
        "commands/show/transceiver/CmdShowTransceiver.h",
        "commands/start/pcap/CmdStartPcap.h",
        "commands/stop/pcap/CmdStopPcap.h",
        "commands/stream/fsdb/CmdStreamSubFsdbOperState.h",
        "commands/stream/fsdb/CmdStreamSubFsdbOperStats.h",
        "facebook/CmdStreamHandler.h",
        "utils/CmdUtils.h",
        "utils/clients/BmcClient.h",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "fbsource//third-party/re2:re2",
        ":cli-cpp2-types",
        ":cmd-common-utils",
        ":cmd-global-options",
        ":cmd-handler",
        ":cmd-local-options",
        ":cmd-subcommands",
        ":commands-show-bgp",
        ":table-utils",
        "//common/base:build_info",
        "//common/config:configerator",
        "//common/http_client:http_client",
        "//common/network:util",
        "//common/smc/cpp:util",
        "//common/smc/if:Smc2-cpp2-clients",
        "//common/smc/if:Smc2-cpp2-services",
        "//common/strings:string_util",
        "//common/thrift/thrift:monitor-cpp2-clients",
        "//common/time:time_core",
        "//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types",
        "//configerator/structs/neteng/bgp_policy/thrift:routing_policy-cpp2-types",
        "//configerator/structs/neteng/fboss/bgp:bgp_config-cpp2-types",
        "//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types",
        "//configerator/structs/neteng/fboss/push/forwarding_stack:fbpkg_map-cpp2-types",
        "//configerator/structs/neteng/netwhoami:netwhoami-cpp2-types",
        "//employee/if:thrift-cpp2-services",
        "//employee/if:thrift-cpp2-types",
        "//fastcli:utils-cpp",
        "//fboss/agent:address_utils",
        "//fboss/agent/hw:hardware_stats-cpp2-types",
        "//fboss/agent/if:common-cpp2-types",
        "//fboss/agent/if:ctrl-cpp2-clients",
        "//fboss/agent/if:ctrl-cpp2-services",
        "//fboss/agent/if:ctrl-cpp2-types",
        "//fboss/agent/if:fboss-cpp2-types",
        "//fboss/agent/if:fboss-cpp2-visitation",
        "//fboss/agent/if:hw_ctrl-cpp2-services",
        "//fboss/agent/if:hw_ctrl-cpp2-types",
        "//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-types",
        "//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/acl:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/acl:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/agent:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/agent:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/arp:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/arp:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/cpuport:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/example:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/example:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/fabric:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/fabric:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/fabric/inputbalance:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/fabric/inputbalance:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/fabric/monitoring:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/fabric/monitoring:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/fabric/reachability:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/bgp/techsupport:bgp_techsupport-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/debugdump:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/environment/sensor:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/openr:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/techsupport:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/flowlet:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/hardware:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/hardware:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/host:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/hwagent:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/lldp:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/lldp:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/mac:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/mac:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/mirror:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/mpls:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/ndp:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/ndp:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/port:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/port:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/product:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/rif:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/rif:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/route:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/route:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/systemport:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/systemport:model-cpp2-visitation",
        "//fboss/cli/fboss2/commands/show/teflow:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-types",
        "//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-visitation",
        "//fboss/fsdb/if:fsdb-cpp2-services",
        "//fboss/fsdb/if:fsdb_common-cpp2-types",
        "//fboss/fsdb/if:fsdb_model",
        "//fboss/fsdb/if:fsdb_oper-cpp2-types",
        "//fboss/fsdb/if:fsdb_oper-cpp2-visitation",
        "//fboss/led_service/if:led_service-cpp2-services",
        "//fboss/lib/inputbalance:input_balance_util",
        "//fboss/lib/phy:phy-cpp2-types",
        "//fboss/lib/phy:phy-cpp2-visitation",
        "//fboss/lib/phy:prbs-cpp2-types",
        "//fboss/lib/phy:prbs-cpp2-visitation",
        "//fboss/mka_service/if:mka_structs-cpp2-types",
        "//fboss/mka_service/if/facebook:mka_service_thrift-cpp2-services",
        "//fboss/platform/data_corral_service/if:data_corral_service-cpp2-services",
        "//fboss/platform/fan_service/if:fan_service-cpp2-services",
        "//fboss/platform/rackmon/if:rackmonsvc-cpp2-services",
        "//fboss/platform/sensor_service/if:sensor_service-cpp2-services",
        "//fboss/qsfp_service/if:qsfp-cpp2-services",
        "//fboss/qsfp_service/if:transceiver-cpp2-types",
        "//folly:conv",
        "//folly:format",
        "//folly:network_address",
        "//folly:range",
        "//folly:string",
        "//folly/container:access",
        "//folly/coro:async_pipe",
        "//folly/coro:blocking_wait",
        "//folly/coro:task",
        "//folly/executors:io_thread_pool_executor",
        "//folly/gen:base",
        "//folly/json:dynamic",
        "//folly/logging:logging",
        "//folly/testing:test_util",
        "//neteng/fboss/bgp/cpp/policy:policy",
        "//neteng/fboss/bgp/if:bgp_stream-cpp2-services",
        "//neteng/fboss/bgp/if:bgp_stream-cpp2-types",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-services",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-types",
        "//neteng/fboss/coop/if:coop_thrift-cpp2-serialization",
        "//neteng/fboss/coop/if:coop_thrift-cpp2-services",
        "//neteng/fboss/coop/if:coop_thrift-cpp2-types",
        "//neteng/fboss/drain/local_drainer/server:thrift-cpp2-clients",
        "//neteng/netwhoami/lib/cpp:client",
        "//neteng/netwhoami/lib/cpp:recover",
        "//neteng/routing/policy/if:policy_thrift-cpp2-types",
        "//nettools/bgplib:bgp_structs",
        "//nettools/bgplib:bgplib",
        "//nettools/bgplib/if:bgp-structs-cpp2-types",
        "//nettools/skynet/if:query-cpp2-types",
        "//nettools/skynet/if:skynet_structs-cpp2-types",
        "//nettools/skynet/lib/cpp:skynet_thrift_client",
        "//nettools/vipinjector/vip_service:util_lib",
        "//nettools/vipinjector/vip_service/if:vip_service-cpp2-services",
        "//nettools/vipinjector/vip_service/if:vip_service-cpp2-types",
        "//openr/common:network_util",
        "//openr/if:if-cpp-cpp2-clients",
        "//openr/if:if-cpp-cpp2-services",
        "//openr/if:if-cpp2-types",
        "//openr/if:kvstore-cpp2-types",
        "//openr/if:network-cpp2-types",
        "//openr/if:openr_config-cpp2-types",
        "//openr/if:types-cpp2-types",
        "//scribe/client:scribe_client_no_sr",
        "//servicerouter/client/cpp2:cpp2",
        "//task/if:if-cpp2-services",
        "//thrift/lib/cpp/transport:transport-core",
        "//thrift/lib/cpp/util:enum_utils",
        "//thrift/lib/cpp2/async:client_buffered_stream",
        "//thrift/lib/cpp2/folly_dynamic:folly_dynamic",
        "//thrift/lib/cpp2/gen:module_types_h",
        "//thrift/lib/cpp2/protocol:protocol",
    ],
    exported_external_deps = [
        ("boost", None, "boost_algorithm"),
    ],
)

cpp_binary(
    name = "fboss2",
    srcs = [
        "Main.cpp",
    ],
    deps = [
        ":cmd-common-utils",
        ":cmd-global-options",
        ":cmd-subcommands",
        ":fboss2-lib",  # @manual
        "//folly/init:init",
        "//folly/logging:init",
        "//folly/logging:logging",
    ],
    external_deps = [
        "CLI11",
    ],
)

cli.metadata(
    name = "cli-fboss2",
    binary_name = "fboss2",
    criticality = cli.criticality(
        level = cli.level.TIER_0,
    ),
    description = "FBOSS agent management frontend.",
    executable = ":fboss2",
)

auto_tab_complete(
    name = "fboss2-tab-complete",
    src = ":fboss2",
)

cpp_binary(
    name = "fboss2-routing-protocol",
    srcs = [
        "Main.cpp",
        "commands/show/facebook/CmdShowUtils.cpp",
        "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyUtils.cpp",
        "facebook/routing_protocol/CmdHandlerImpl.cpp",
        "facebook/routing_protocol/CmdList.cpp",
        "utils/facebook/routing_protocol/CmdClientUtils.cpp",
        "utils/facebook/routing_protocol/CmdUtils.cpp",
    ],
    headers = [
        "commands/show/facebook/CmdShowVersionBgp.h",
    ],
    deps = [
        ":cmd-common-utils",
        ":cmd-global-options",
        ":cmd-handler",
        ":cmd-list-header",
        ":cmd-local-options",
        ":cmd-subcommands",
        ":commands-show-bgp",
        ":table-utils",
        "//common/config:configerator",
        "//common/strings:string_util",
        "//common/time:time_core",
        "//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types",
        "//configerator/structs/neteng/bgp_policy/thrift:routing_policy-cpp2-types",
        "//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types",
        "//configerator/structs/neteng/fboss/push/forwarding_stack:fbpkg_map-cpp2-types",
        "//fastcli:utils-cpp",
        "//fboss/agent:address_utils",
        "//folly:network_address",
        "//folly:range",
        "//folly:string",
        "//folly/init:init",
        "//folly/json:dynamic",
        "//folly/logging:init",
        "//folly/logging:logging",
        "//neteng/fboss/bgp/cpp/policy:policy",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-services",
        "//neteng/fboss/bgp/if:bgp_thrift-cpp2-types",
        "//neteng/routing/policy/if:policy_thrift-cpp2-types",
        "//nettools/bgplib:bgp_structs",
        "//nettools/bgplib:bgplib",
        "//nettools/bgplib/if:bgp-structs-cpp2-types",
        "//nettools/skynet/if:query-cpp2-types",
        "//nettools/skynet/if:skynet_structs-cpp2-types",
        "//nettools/skynet/lib/cpp:skynet_thrift_client",
        "//openr/common:network_util",
        "//openr/if:if-cpp2-types",
        "//openr/if:network-cpp2-types",
        "//openr/if:types-cpp2-types",
        "//servicerouter/client/cpp2:cpp2",
        "//thrift/lib/cpp/util:enum_utils",
    ],
    external_deps = [
        "CLI11",
    ],
)
